<!--火情弹窗-->
<template>
    <div class="popContainer" v-show="isShow">
        <div class="content">
            <div>
                <el-row>
                    <el-col :span="22">
                        <h2 class="text-center">{{fireInfo.title}}</h2>
                    </el-col>
                    <el-col :span="2">
                        <h2 class="text-center pointer" @click="close">
                            <el-icon class="el-icon-close" ></el-icon>
                        </h2>
                    </el-col>
                </el-row>
            </div>
            <div>
                <el-form :model="fireInfo" ref="fireInfo" label-width="150px">
                    <el-form-item label="内容:" prop="enterpriseName">
                        {{ fireInfo.message}}
                    </el-form-item>
<!--                    <el-form-item label="待办人:" prop="userName">-->
<!--                        {{ fireInfo.userName }}-->
<!--                    </el-form-item>-->
<!--                    <el-form-item label="通知时间:" prop="noticeTime">-->
<!--                        {{ fireInfo.noticeTime |dateFormat }}-->
<!--                    </el-form-item>-->
<!--                    <el-form-item label="待办状态:" prop="status">-->
<!--                        {{ fireInfo.status |agencyStatus}}-->
<!--                    </el-form-item>-->
<!--                    <el-form-item label="详细内容:" prop="content">-->
<!--                        {{ fireInfo.content }}-->
<!--                    </el-form-item>-->
                    <!--          <el-form-item label="描述:" prop="remark">-->
                    <!--            {{ agencyInfo.remark }}-->
                    <!--          </el-form-item>-->
                    <!--          <el-form-item label="待办Id:" prop="remark">-->
                    <!--            {{ agencyInfo.agencyId }}-->
                    <!--          </el-form-item>-->
                    <div class="text-center">
                        <el-button type="success" @click="enterInfo">确认查看</el-button>
                    </div>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
import transferStation from "@/utils/transferStation"
export default {
    name: "fireAlarm",
    data(){
        return{
            isShow:false,
            resolve:'',
            reject:'',
            promise:null,
            videoTitle:"",
            videoUrl:"",
            videoDialogVisible:false,
            mapDialogVisible:false
        }
    },
    props: {
        fireInfo:{
            type: Object,
            default: function () {
                return {
                    name:"火情"
                }
            }
        }
    },
    methods:{
        closeAudio(){
            transferStation.$emit('closeAudio1','关闭声音');
        },
        show(){
            this.isShow = true;
            this.promise = new Promise((resolve, reject) => {
                this.resolve = resolve;
                this.reject = reject;
            });
            // 返回promise对象
            return this.promise;
        },
        enterInfo(){
            this.isShow = false;
            this.resolve('enterInfo');
            this.remove();
        },
        close(){
            this.closeAudio()
            this.isShow = false;
            this.reject('cancel');
            this.remove();
        },
        remove: function () {
            setTimeout(() => {
                this.destroy();
            }, 300);
        },
        destroy: function () {
            this.$destroy();
            document.body.removeChild(this.$el);
        },
        openFireVodie(){
            this.$nextTick(()=>{
                this.videoUrl = this.fireInfo.fireVodie
                this.videoTitle = "火情现场视频"
                this.videoDialogVisible = true
            })
        },
        openInspectionVideo(){
            this.$nextTick(()=>{
                this.videoUrl = this.fireInfo.inspectionVideo
                this.videoTitle = "火情勘察视频"
                this.videoDialogVisible = true
            })
        },
        openMap(){
            this.$nextTick(()=>{
                this.mapDialogVisible = true
            })
        }
    }
}
</script>

<style scoped lang="scss">
    .popContainer {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 9999;
        .content{
            width: 50%;
            min-height: 50vh;
            background: #fff;
            position: absolute;
            top: 10vh;
            left: 25%;
            padding: 5px 20px 20px;
        }
    }
    .map-view{
        width: 100%;
        height: 400px;
    }
</style>